package com.cykj.pos.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cykj.pos.domain.BizMicroInfo;
import com.cykj.pos.domain.FeiShunSettlement;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 *派达薪任务实体
 * @author mx
 * @date 2023-08-29
 */
public interface FeiShunSettlementMapper extends BaseMapper<FeiShunSettlement> {

    @Select("select * from fei_shun_settlement where status in ('1','6') ")
    List<FeiShunSettlement> getlist();
    @Select("select * from fei_shun_settlement where task_user_id=#{taskUserId} ")
    FeiShunSettlement getSett(@Param("taskUserId") String orderNo);

    @Update("update fei_shun_settlement set status= #{status},error_message=#{errorMessage},url=#{url} where task_user_id=#{taskUserId}")
    int updateTaskUser(@Param("status") String status,@Param("errorMessage") String errorMessage,@Param("url") String url,@Param("taskUserId") String taskUserId);

    @Select("select * from biz_micro_info a LEFT JOIN biz_merchant b on a.merch_id =  b.merch_id \n" +
            "LEFT JOIN biz_cashout_records c on b.user_id = c.create_by \n" +
            "LEFT JOIN fei_shun_settlement d on d.order_no = c.var1\n" +
            "where d.order_no = #{orderNo}")
    BizMicroInfo getBizMicroInfoByOrderNo(String orderNo);
}
